﻿using System.Collections.Generic;
using System.Linq;
using Risk.Services;

namespace Site.Models
{
    /// <summary>
    /// Data transfer object for the game
    /// </summary>
    public class GameDTO
    {

        public int Id { get; set; }
        public GameDTO(int gameId)
        {
            Id = gameId;
        }
        

        /// <summary>
        /// The players of the game
        /// </summary>
        public List<PlayerDTO> Players
        {
            get{ return DatabaseManager.GetPlayerIds(Id).Select(playerId => new PlayerDTO(playerId)).ToList(); }
        }

        /// <summary>
        /// The armies in this game
        /// </summary>
        public List<ArmyDTO> Armies { get
        {
            List<int> armyIds = DatabaseManager.ArmyIds(Id);
            return armyIds.Select(armyId => new ArmyDTO(armyId)).ToList();
        } }
    }
}